var t,
  a = require("../../@babel/runtime/helpers/defineProperty"),
  o = require("../../res/www.a9a.cn.js"),
  e = getApp();
Page({
  data: {
    vip_height: "height:10rpx;max-height:10rpx;",
    morebtn_ico: "",
    vip_morebtn_onoff: "off",
    nTitle: "我的推广中心",
    btm_nav: "my",
    btmnavbg_color: "#B8BCCC",
    btmnavbg_rgbcolor: o.c16_rgb("#B8BCCC"),
    mask_class: "alpha0_100",
  },
  onLoad: function (t) {
    var a = this,
      i = this;
    e.get_config("_ZEAI").then(function (t) {
      i.setData({ color: e._ZEAI.color, rgbcolor: o.c16_rgb(e._ZEAI.color) }),
        wx.setNavigationBarColor({
          backgroundColor: "#FF5D48",
          frontColor: "#ffffff",
        }),
        wx.setBackgroundColor({ backgroundColorTop: "#FF5D48" });
    }),
      e.get_openid().then(function (t) {
        a.init();
      });
  },
  init: function () {
    var a = this;
    wx.showNavigationBarLoading(),
      (t = wx.getStorageSync("COOK_U")),
      e.ajax({
        url: "tg.php",
        data: { submitok: "MY_VIP", openid: t.openid },
        success: function (t) {
          switch ((wx.hideNavigationBarLoading(), t.flag)) {
            case "1":
            case 1:
              var e = t.D.color;
              a.setData({
                LIST: t.LIST,
                SHARE: t.SHARE,
                MB: t.MB,
                nTitle: t.nTitle,
                D: t.D,
              }),
                wx.setNavigationBarColor({
                  backgroundColor: e,
                  frontColor: "#ffffff",
                }),
                wx.setNavigationBarTitle({ title: t.nTitle }),
                wx.setBackgroundColor({ backgroundColorTop: e });
              break;
            case "flag0":
            case "flag_1":
            case "flag2":
              wx.reLaunch({ url: "reg?t=" + t.flag });
              break;
            default:
              (t.this = a), (t.url = "no"), o.sorry(t);
          }
        },
      });
  },
  vipFn: function (a) {
    var i = a.currentTarget.dataset.grade,
      r = this;
    o.empty(r.data.MB) || e.openSetting(r.data.MB),
      wx.showNavigationBarLoading(),
      (t = wx.getStorageSync("COOK_U")),
      e.ajax({
        url: "tg.php",
        data: { submitok: "MY_VIP_update", grade: i, openid: t.openid },
        success: function (a) {
          switch ((wx.hideNavigationBarLoading(), a.flag)) {
            case "1":
            case 1:
              wx.showModal({
                content: a.msg,
                confirmColor: r.data.color,
                confirmText: "朕知道了",
                showCancel: !1,
                success: function (t) {
                  wx.redirectTo({ url: "/pages/tg/my" });
                },
              });
              break;
            case "pay":
              e.pay({
                data: { submitok: "tg_pay_vip", grade: i, openid: t.openid },
                success: function () {
                  wx.redirectTo({ url: "/pages/tg/my" });
                },
                fail: function (t) {
                  (t.this = r), (t.url = "no"), o.sorry(t);
                },
              });
              break;
            case "flag0":
            case "flag_1":
            case "flag2":
              wx.reLaunch({ url: "reg?t=" + a.flag });
              break;
            default:
              (a.this = r), (a.url = "no"), o.sorry(a);
          }
        },
      });
  },
  vipmoreFn: function () {
    "off" == this.data.vip_morebtn_onoff
      ? this.setData({
          vip_morebtn_onoff: "on",
          morebtn_ico: "",
          vip_height: "height:auto;max-height:1000rpx;",
        })
      : this.setData({
          vip_morebtn_onoff: "off",
          morebtn_ico: "",
          vip_height: "height:10rpx;max-height:10rpx;",
        });
  },
  onPullDownRefresh: function () {
    var t = this;
    wx.vibrateShort({ type: "heavy" }),
      setTimeout(function () {
        wx.stopPullDownRefresh(), t.init();
      }, 500);
  },
  back: function () {
    this.setData({ div_login: !1 });
  },
  mask_closeFn: function (t) {
    var o = this,
      e = t.currentTarget.dataset.maskid;
    this.setData({
      mask_class: "alpha100_0",
      div_outlist_box_class: "div_upAnm2",
    }),
      setTimeout(function () {
        var t;
        o.setData(
          (a((t = {}), e, !1),
          a(t, "mask_class", "alpha0_100"),
          a(t, "div_outlist_box_class", "div_upAnm1"),
          t)
        );
      }, 500);
  },
  emptyFn: function () {},
  onShareAppMessage: function (t) {
    return {
      imageUrl: this.data.SHARE.imgurl,
      title: this.data.SHARE.title,
      path: "/pages/tg/my_vip",
    };
  },
  onShareTimeline: function () {
    return {
      imageUrl: this.data.SHARE.imgurl,
      title: this.data.SHARE.title,
      query: "",
      path: "/pages/tg/my_vip",
    };
  },
});
